package api;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class TestIterator2 {
    public static void main(String[] args) {
        //构建约束是，等号左边必须有，右边可以没有
        Collection<String> c = new ArrayList<>();
        c.add("one");
        c.add("two");
        c.add("three");
        Iterator<String > iterator = c.iterator();
        while (iterator.hasNext()){
            String s  = iterator.next();
            System.out.println(s.toUpperCase());
        }

    }
}
